﻿using EasyXaf.Sample.ODataService.Models;

namespace EasyXaf.Sample.ODataService;

public static class MockData
{
    public static List<Company> Companies { get; }

    public static IEnumerable<Department> Departments => Companies.SelectMany(c => c.Departments).ToList();

    static MockData()
    {
        Companies = new List<Company>();

        for (var i = 0; i < 10000; i++)
        {
            var company = new Company
            {
                Id = Guid.NewGuid(),
                Name = $"公司{i + 1:00000}",
                Departments = new List<Department>()
            };

            for (var j = 0; j < 5; j++)
            {
                var department = new Department
                {
                    Id = Guid.NewGuid(),
                    Name = $"部门{i * 10000 + j + 1:00000}",
                    Company = company
                };

                company.Departments.Add(department);
            }

            Companies.Add(company);
        }
    }
}
